<?php

namespace App\Content\Providers;

use App\Content\Contracts\AdvInterface;
use App\Content\Contracts\ArticleClassInterface;
use App\Content\Contracts\ArticleInterface;
use App\Content\Contracts\BulletinInterface;
use App\Content\Contracts\WxUsersInterface;
use App\Content\Repositories\DbAdvRepository;
use App\Content\Repositories\DbArticleClassRepository;
use App\Content\Repositories\DbArticleRepository;

use App\Content\Repositories\DbBulletinRepository;
use App\Content\Repositories\DbWxUsersRepository;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;


class ContentServiceProvider extends ServiceProvider
{
    protected $admin_namespace = 'App\Content\Controllers\Admin';
    protected $home_namespace = 'App\Content\Controllers\Home';
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //后台管理
        Route::middleware('web')
            ->namespace($this->admin_namespace)
            ->group(__DIR__."/../admin_routes.php");
        //前台管理
        Route::middleware('web')
            ->namespace($this->home_namespace)
            ->group(__DIR__."/../routes.php");
//        require __DIR__.'/../routes.php';
//        require __DIR__.'/../admin_routes.php';
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind(ArticleInterface::class, DbArticleRepository::class); //文章管理
        $this->app->bind(ArticleClassInterface::class, DbArticleClassRepository::class); //广告管理
        $this->app->bind(AdvInterface::class, DbAdvRepository::class); //广告管理
        $this->app->bind(BulletinInterface::class, DbBulletinRepository::class); //消息管理
        $this->app->bind(WxUsersInterface::class, DbWxUsersRepository::class); //消息管理

    }
}
